<template>
	<el-form ref="form" label-width="85px" :model="form" :rules="rules">
		<el-form-item label="消息内容:" prop="content">
			<el-input v-model="form.content" class="md:w-[302px]" type="textarea" :rows="16" placeholder="请输入信息内容" maxlength="500" show-word-limit> </el-input>
		</el-form-item>
		<el-form-item>
			<div class="mt-[6px] text-[#F14A46] text-[12px] mb-[32px]">注：欢迎注册是为新用户注册成功时，默认发送给用户的消息</div>
			<el-button :loading="loading" class="!w-[107px] !h-[40px]" type="primary" @click="handleSubmit">保存 </el-button>
		</el-form-item>
	</el-form>
</template>

<script>
export default {
	name: 'Registered',
	data() {
		return {
			loading: false,
			form: {
				content: null,
			},
			rules: {
				content: [{ required: true, message: '请输入消息内容', trigger: 'blur' }],
			},
		};
	},
	created() {
		this.getContent();
	},
	methods: {
		getContent() {
			this.$request
				.post('/system/system/list', {
					id: 3,
					pageNum: 1,
					pageSize: 10,
				})
				.then((res) => {
					this.form.content = res.data.records && res.data.records[0].keyValue;
				});
		},
		handleSubmit() {
			this.$refs.form.validate((valid) => {
				if (valid) {
					this.$request
						.post('/system/system/edit', {
							id: 3,
							keyValue: this.form.content,
							keyName: '注册成功消息',
						})
						.then(() => {
							this.msgSuccess('编辑成功');
						});
				}
			});
		},
	},
};
</script>

<style scoped></style>
